<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const str="cdtw.com";
        console.log(str.indexOf("m"));//7
        console.log(str.indexOf("s"));//-1没有找到，返回-1
        console.log(str.indexOf("w",5));//可以给值，让它从哪里找,我这里是第5个开始找
   
       console.log(str.includes("m"));//true，看字符串里面是否有m
       
       //字符串开头或结尾
       console.log(str.startsWith("c"));
       console.log(str.endsWith("m"));
       //字符串的替换
       console.log(str.replace("cd","成都"));
   </script>
</body>
</html>